<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr =[
            {id:1001,name:"苹果手机",price:5000,checked:true},
            {id:1001,name:"华为手机",price:6000,checked:true},
            {id:1001,name:"OPPO手机",price:4000,checked:true},
            {id:1001,name:"小米手机",price:3500,checked:false},
        ]

        // 判断 是否全选
        // var result = arr.every(item => {
        //     return item.checked == true
        // })
        // console.log(result);

        // some函数
        // var result = arr.some(item => {
        //     return item.checked == true
        // })

        // console.log(result);
        // 计算总价
        // var arr =[1,2,3,4,5]
        var result = arr.reduce((total,item) => {
            return total += item.price
        },0)
        console.log(result);
    </script>,
</body>
</html>